package org.etlt.expression;

import org.etlt.expression.function.FunctionEnabled;

public class ContextFunctions {
    @FunctionEnabled(value = "set", help = "set value into context")
    public Object setValue(String name, Object value){
        MainContext context = MainContext.getInstance();
        context.getData().put(name, value);
        return value;
    }

    @FunctionEnabled(value = "get", help = "get value from context")
    public Object getValue(String name){
        MainContext context = MainContext.getInstance();
        return context.getData().get(name);
    }

    @FunctionEnabled(value = "clear", help = "clear all values from context")
    public void clear(){
        MainContext context = MainContext.getInstance();
        context.getData().clear();
    }
}
